/*
 * Copyright (C)  Tsing Micro Co., Ltd. All rights reserved.
 *
 */

#ifndef MTD_TINY_H
#define MTD_TINY_H

#include <stdint.h>

#include <aos/hal/flash.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum mtype {
    MTD_FLASH  = 0, 
    MTD_EMMC,           
    MTD_SD,        
} mtype_t;


typedef struct mtd {
    mtype_t     type;
    int         (*read)(hal_partition_t in_partition, uint32_t *off_set, void *out_buf, uint32_t in_buf_len);
    int         (*write)(hal_partition_t in_partition, uint32_t *off_set, const void *in_buf, uint32_t in_buf_len);
    int         (*erase)(hal_partition_t in_partition, uint32_t off_set, uint32_t size);
} mtd_t;


extern mtd_t mtd;

#ifdef __cplusplus
}
#endif

#endif
